package com.example.administrator.xiaobo.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.LinkedList;

/**
 * Created by Administrator on 2017/2/7.
 */

public class LiveFragmentPageAdapter extends FragmentPagerAdapter {
    private LinkedList<Fragment> data;
    private String [] titles;
    public LiveFragmentPageAdapter(FragmentManager fm,LinkedList<Fragment> data,String[] titles) {
        super(fm);
        this.data = data;
        this.titles = titles;
    }

    @Override
    public Fragment getItem(int position) {

        return data.get(position);
    }

    @Override
    public int getCount() {
        return data==null?0:data.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
